package utils

import (
	"strings"
)

// StringInSlice 判断字符串是否在数组内
func StringInSlice(items []string, element string) bool {
	for _, item := range items {
		if strings.Contains(item, ",") {
			temps := strings.Split(item, ",")
			for _, i := range temps {
				if element == i {
					return true
				}
			}
		} else if element == item {
			return true
		}
	}
	return false
}

// IntInSlice 判断数字是否在数组内
func IntInSlice(items []int, element int) bool {
	for _, item := range items {
		if element == item {
			return true
		}
	}
	return false
}
